/*
 * @Author: your name
 * @Date: 2021-07-12 16:17:29
 * @LastEditTime: 2022-01-14 11:22:00
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \hbs\routes\org.ts
 */
/**  -----------  常用类库  -------------   */
import { Router, Request, Response, text, request } from "express";

const config = require("config-lite")(__dirname);
import Mysql_Moudle from "../libs/sqlcmd/mysql";
let MYSQL = new Mysql_Moudle(config.mysql);
const path = require("path")
import FileTools from "../libs/tools/filetools"
import { Req } from "../libs/tools/Tools";
/** ---------  常用类库!结束!-------------- */
const router = Router();
const formidableMiddleware = require('express-formidable');
router.use(formidableMiddleware({
    encoding: 'utf-8',
    uploadDir: path.join(__dirname, '../up/linshi'),
    multiples: true, // req.files to be arrays of files
}));
router.post("/", async (req: any, res, next) => {
    var result :any = await FileTools.upLinshi(req.files.file, "up/linshi");
    var path = await FileTools.moveTo(result.path, "up/image", "up/image/")
    return res.json(result);
});
export default router;